import type { PageParams, PageResult } from "@/types/global"
import type { BannerItem, CategoryItem, GuessItem, HotItem } from "@/types/home"
import { http } from "@/utils/http"

enum API {
  HOME_BANNER_URL = '/home/banner',
  HOME_CATEGORY_URL = '/home/category/mutli',
  HOME_HOT_URL = '/home/hot/mutli',
  HOME_Goods_URL = '/home/goods/guessLike'
}
// distributionSite 广告区域展示位置
// 1 为首页（默认值）
// 2 为商品分类页
export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: API.HOME_BANNER_URL,
    data: {
      distributionSite
    }
  })
}

// 分类接口
export const getHomeCategoryAPI = () => {
  return http<CategoryItem[]>({
    method: 'GET',
    url: API.HOME_CATEGORY_URL
  })
}

// 热门数据推荐接口
export const getHomeHotAPI = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: API.HOME_HOT_URL
  })
}

// 猜你喜欢接口
export const getHomeGoodsGuessLikeAPI = (data?:PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: API.HOME_Goods_URL,
    data
  })
}
